/*
 * Copyright (c) JoinQuant Development Team
 * Author: Huayong Kuang <kuanghuayong@joinquant.com>
 */

#include <iostream>
#include <unordered_map>
using namespace std;

typedef unordered_map<int, int> uo_map_t;

string check_key(uo_map_t m, int key)
{
    // Key is not present
    if (m.find(key) == m.end())
        return "Not Present";

    return "Present";
}

int main()
{
    uo_map_t m;

    // Initializing keys and mapped values
    m[1] = 4;
    m[2] = 6;
    m[4] = 6;

    // Keys to be checked
    int check1 = 5, check2 = 4;

    // Function call
    cout << check1 << ": " << check_key(m, check1) << endl;
    cout << check2 << ": " << check_key(m, check2) << endl;

    int t = m[10];
    cout << "try get value from map: " << t << endl;

    int t2 = m.at(20);
    cout << "at 20: " << t2 << endl;
}
